<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@include file="/common/common.jsp"%>
<h:css href="/css/style1/style-custom.css"/>
<%@include file="/common/skins/skin0/component.jsp" %>
<%--
- Author(s): pengweiling
- Date: 2012-10-03 03:35:15
- Description:
--%>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>
      订单维护
    </title>
  </head>
  <body>
    <%
       String formAct = "com.hms.OrderMgr.ordeEntry.flow";
       boolean isModify = false;
       if (request.getAttribute("isModify") != null){
          formAct = "com.hms.OrderMgr.orderEntryModify.flow";
          isModify = true;
       } 
     %>
    <e:datasource name="criteria" type="entity" path="com.primeton.das.criteria.criteraiType" />
    <e:datasource name="page" type="entity" path="com.eos.foundation.PageCond" />
    <e:datasource name="weorders" type="entity" path="com.hms.OrderMgr.order.WeOrdertasks" />
    <queryform id= "a764a278-18a4-426d-b9d2-210b2da1f01d">
      <h:form  name="query_form" action="<%=formAct %>" checkType="blur" target="_self" method="post" onsubmit="return checkForm(this);">
        <input type="hidden" name="_eosFlowAction" value="pageQuery"/>
          <table align="center" border="0" width="100%" class="form_table">
            <tr>
              <td class="form_label">
                订单编号
              </td>
              <td colspan="1">
                <h:text property="criteria/_expr[1]/corderno"/>
                <h:hidden property="criteria/_expr[1]/_op" value="like"/>
                <h:hidden property="criteria/_expr[1]/_likeRule" value="all"/>
              </td>
              <td class="form_label">
                预订人
              </td>
              <td colspan="1">
                <h:text property="criteria/_expr[2]/cbookname"/>
                <h:hidden property="criteria/_expr[2]/_op" value="like"/>
                <h:hidden property="criteria/_expr[2]/_likeRule" value="all"/>
              </td>
              <td class="form_label">
                会员
              </td>
              <td colspan="1"> 
                <h:text property="criteria/_expr[3]/cmembername"/>
                <h:hidden property="criteria/_expr[3]/_op" value="like"/>
                <h:hidden property="criteria/_expr[3]/_likeRule" value="all"/>                
              </td>              
            </tr>

            <tr>
              <td class="form_label">
                客人来源
              </td>
              <td colspan="1">
                <d:select property="criteria/_expr[4]/csourcename" nullLabel="所有" dictTypeId="HMS_CUSTOMER_SRC" />
              </td>
              <td class="form_label">
                业务员
              </td>
              <td colspan="1">
                <h:text property="criteria/_expr[5]/salesname"/>
                <h:hidden property="criteria/_expr[5]/_op" value="like"/>
                <h:hidden property="criteria/_expr[5]/_likeRule" value="all"/>
                
                <h:hidden property="criteria/_expr[7]/cstatus"/>
                <h:hidden property="criteria/_expr[7]/_op" value="in"/>
                                
              </td>
              <td class="form_label">
                状态
              </td>
              <td colspan="1">
                <h:select property="criteria/_expr[6]/cstatus">
                   <option value="">所有</option>
                   <option value="S">草稿</option>
                   <option value="C">取消</option>
                   <option value="B">待审核</option>
                   <option value="P">待支付确认</option>
                   <option value="Y">审核确认</option>
                   <option value="I">入住</option>
                   <option value="O">已结</option>
                   <option value="X">已退未结</option>
                   <option value="D">已结未退</option>  
                   <option value="V">VIP审核</option>              
                </h:select>
              </td>              
            </tr>
            
            <tr class="form_bottom">
              <td colspan="6" class="form_bottom">
                <input type="hidden" name="criteria/_entity" value="com.hms.roomfoundation.roomfnd.WeRoomsourceEntryV">
                每页显示
                <h:text size="2" property="page/length" value="10" validateAttr="minValue=1;maxValue=100;type=integer;isNull=true" />
                <input type="hidden" name="page/begin" value="0">
                <input type="hidden" name="page/isCount" value="true">
                <input type="submit" value="查询" class="button">
              </td>
            </tr>
          </table>
      </h:form>
    </queryform>
    <br/>
    <viewlist id= "66776ab8-ebb9-439d-ae0c-1d0710d9eaff">
      <h:form name="page_form" action="<%=formAct %>" method="post">
        <input type="hidden" name="_eosFlowAction" value="pageQuery" >
        <h:hiddendata property="criteria" />
        <h:hidden property="page/begin"/>
        <h:hidden property="page/length"/>
        <h:hidden property="page/count"/>
        <h:hidden property="page/isCount"/>
          <table align="center" border="0" width="100%" class="EOS_table">
            <tr>
              <th align="center">
                选择
              </th>
              <th>
                订单编号
              </th>
              <th>
                状态
              </th>              
              <th>
                预订人
              </th>
              <th>
                会员
              </th>    
              <th>
                业务员
              </th>                           
              <th>
                客人来源
              </th>
              <th>
                是否接机
              </th>
              <th>
                接机时间
              </th>
              <th>
                是否送机
              </th>
              <th>
                送机时间
              </th>
            </tr>
            <w:checkGroup id="group1">
              <l:iterate property="weorders" id="id1">
                <tr class="<l:output evenOutput='EOS_table_row' />">
                  <td align="center">
                    <w:rowCheckbox>
                      <h:param name='select_objs/iorderid' iterateId='id1' property='iorderid' indexed='true' />
                    </w:rowCheckbox>
                  </td>
                  <td>
                    <b:write iterateId="id1" property="corderno"/>
                  </td>
                  <td>
                    <l:equal iterateId="id1" property="cstatus" targetValue="S"> 
                      草稿
                    </l:equal>
                    <l:equal iterateId="id1" property="cstatus" targetValue="C"> 
                      取消
                    </l:equal>
                    <l:equal iterateId="id1" property="cstatus" targetValue="B"> 
                      待审核
                    </l:equal>
                    <l:equal iterateId="id1" property="cstatus" targetValue="P"> 
                      待支付确认
                    </l:equal>
                    <l:equal iterateId="id1" property="cstatus" targetValue="Y"> 
                      审核确认
                    </l:equal>
                    <l:equal iterateId="id1" property="cstatus" targetValue="I"> 
                      入住
                    </l:equal>
                    <l:equal iterateId="id1" property="cstatus" targetValue="O"> 
                      已结
                    </l:equal>
                    <l:equal iterateId="id1" property="cstatus" targetValue="X"> 
                      已退未结
                    </l:equal>
                    <l:equal iterateId="id1" property="cstatus" targetValue="D"> 
                      已结未退
                    </l:equal>   
                    <l:equal iterateId="id1" property="cstatus" targetValue="V"> 
                      VIP审核
                    </l:equal>                                                                                                                    
                  </td>
                  <td>
                    <b:write iterateId="id1" property="cbookname"/>
                  </td>
                  <td>
                    <b:write iterateId="id1" property="cmembername"/>
                  </td>
                  <td>
                    <b:write iterateId="id1" property="salesname"/>
                  </td>
                  <td>
                    <d:write iterateId="id1" property="csourcename" dictTypeId="HMS_CUSTOMER_SRC"/>
                  </td>
                  <td>
                    <b:write iterateId="id1" property="bispickup"/>
                  </td>
                  <td>
                    <b:write iterateId="id1" property="dpickupdate" formatPattern="yyyy-MM-dd hh:mm"/>
                  </td>
                  <td>
                    <b:write iterateId="id1" property="bisseeoff"/>
                  </td>
                  <td>
                    <b:write iterateId="id1" property="dseeoffdate"  formatPattern="yyyy-MM-dd hh:mm"/>
                  </td>
                </tr>
              </l:iterate>
            </w:checkGroup>
            <tr>
              <td colspan="16" class="command_sort_area">
                <div style="float:left">
                <%
                   if (isModify == false){
                 %>                
                <input type="button" value="新增预定" onclick="addRecord();" class="button">
                <l:greaterThan property="page/size" targetValue="0" compareType="number">
                  <input type="button" value="预定详情" onclick="updateRecord();" class="button">
                </l:greaterThan>
                <!-- 
                <l:greaterThan property="page/size" targetValue="0" compareType="number">
                  <input type="button" value="删除" onclick="deleteRecord();" class="button">
                </l:greaterThan>
                 -->
                 <%
                 }else{
                  %>
                  <input type="button" value="预定修改" onclick="modifyOrder();" class="button">
                  <%
                  }
                   %>
                </div>
                <div style="float:right">
                  <l:equal property="page/isCount" targetValue="true">
                    共
                    <b:write property="page/count"/>
                    条记录 第
                    <b:write property="page/currentPage"/>
                    页/
                    <b:write property="page/totalPage"/>
                    页
                  </l:equal>
                  <l:equal property="page/isCount" targetValue="false">
                    第
                    <b:write property="page/currentPage"/>
                    页
                  </l:equal>
                  <input type="button" onclick="firstPage('page', 'pageQuery', null, null, 'page_form');" value="首页"  <l:equal property="page/isFirst" targetValue="true">disabled</l:equal> >
                  <input type="button" onclick="prevPage('page', 'pageQuery', null, null, 'page_form');" value="上页" <l:equal property="page/isFirst" targetValue="true">disabled</l:equal> >
                  <input type="button" onclick="nextPage('page', 'pageQuery', null, null, 'page_form');" value="下页" <l:equal property="page/isLast" targetValue="true">disabled</l:equal> >
                  <l:equal property="page/isCount" targetValue="true">
                    <input type="button" onclick="lastPage('page', 'pageQuery', null, null, 'page_form');" value="尾页" <l:equal property="page/isLast" targetValue="true">disabled</l:equal> >
                  </l:equal>
                </div>
              </td>
            </tr>
          </table>
      </h:form>
    </viewlist>
    <script>
      function updateRecord()
      {
        var g = $id("group1");
        var frm = $name("page_form");
        if (g.getSelectLength() != 1) {
          alert("请选择一行记录！");
          return;
        }
        frm.elements["_eosFlowAction"].value = "update";
        frm.submit();
      }
      function addRecord()
      {
        var frm = $name("page_form");
        frm.elements["_eosFlowAction"].value = "insert";
        frm.submit();
      }
      function deleteRecord()
      {
        var g = $id("group1");
        var frm = $name("page_form");
        if (g.getSelectLength() < 1) {
          alert("请选择记录！");
          return;
        }
        frm.elements["_eosFlowAction"].value = "delete";
        frm.submit();
      }
      
      function modifyOrder(){
        var g = $id("group1");
        var frm = $name("page_form");
        if (g.getSelectLength() != 1) {
          alert("请选择一行记录！");
          return;
        }
        frm.elements["_eosFlowAction"].value = "update";
        frm.submit();
      }
    </script>
  </body>
</html>
